<?php
namespace app\admin\controller;
use app\common\model\Faq as Model;



class Faq extends \C {

  public function index(){

    $faq=Model::where("status",1)->all();
    $html="";
    foreach($faq as $v){
      $q=$v["q"];
      $a=$v["a"];
      $id="id".uniqid();
      $html.=<<<CODE

      <div class="card m-b-0 border-0">
          <div class="card-header p-l-0">
              <h5 class="mb-0">
                  <a href="#" class="link p-10 collapsed" id="a$id" data-toggle="collapse" data-target="#$id" aria-expanded="false" aria-controls="$id">
                      $q
                  </a>
              </h5>
          </div>
          <div id="$id" class="collapse" aria-labelledby="a$id" style="">
              <div class="card-body p-l-1">
                  $a
              </div>
          </div>
      </div>

CODE;
    }







    $t=<<<CODE
{layout name="/public/layout_index" /}

    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-body">
                    <h4 class="card-title">常见问题</h4>
                    <!-- Accordian-part -->
                    <div id="accordian-part">
                        <div id="accordian-3">

                            $html

                        </div>
                    </div>
                    <!-- End accordian-part -->
                </div>
            </div>
        </div>
    </div>
CODE;
    return $this->display($t,$this->VD());
  }


}
